package cn.ht.jywrwater.module.ht.dal.mysql.waterleakageanalysis;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterleakageanalysis.WaterLeakageAnalysisDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterleakageanalysis.vo.*;

/**
 * 漏损分析 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterLeakageAnalysisMapper extends BaseMapperX<WaterLeakageAnalysisDO> {

    default PageResult<WaterLeakageAnalysisDO> selectPage(WaterLeakageAnalysisPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterLeakageAnalysisDO>()
                .eqIfPresent(WaterLeakageAnalysisDO::getType, reqVO.getType())
                .eqIfPresent(WaterLeakageAnalysisDO::getWaterCount, reqVO.getWaterCount())
                .eqIfPresent(WaterLeakageAnalysisDO::getRegion, reqVO.getRegion())
                .betweenIfPresent(WaterLeakageAnalysisDO::getDataDate, reqVO.getDataDate())
                .betweenIfPresent(WaterLeakageAnalysisDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterLeakageAnalysisDO::getId));
    }

    default List<WaterLeakageAnalysisDO> selectList(WaterLeakageAnalysisExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterLeakageAnalysisDO>()
                .eqIfPresent(WaterLeakageAnalysisDO::getType, reqVO.getType())
                .eqIfPresent(WaterLeakageAnalysisDO::getWaterCount, reqVO.getWaterCount())
                .eqIfPresent(WaterLeakageAnalysisDO::getRegion, reqVO.getRegion())
                .betweenIfPresent(WaterLeakageAnalysisDO::getDataDate, reqVO.getDataDate())
                .betweenIfPresent(WaterLeakageAnalysisDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterLeakageAnalysisDO::getId));
    }

}
